HAL GENERIC initialization and control functions migration ¶
This section provides information about the HAL GENERIC control functions migration.
HAL GENERIC functions migration ¶
HAL GENERIC initialization functions migration ¶
The following table lists the HAL initialization and De-initialization functions, indicating those that remain unchanged between HAL1 and HAL2
|
Function |
HAL1 / HAL2 |
|---|---|
|
Initialization |
HAL1: HAL_StatusTypeDef HAL_Init(void)
HAL2: hal_status_t HAL_Init(void) //Return type changed to follow new naming convention
|
|
De-initialization |
HAL1: HAL_StatusTypeDef HAL_DeInit(void)
HAL2: hal_status_t HAL_DeInit(void) //Return type changed to follow new naming convention
|
Time base configuration function migration ¶
In HAL2, the HAL_InitTick function has been updated to include the functionality of HAL_SetTickFreq , consolidating both functions into a single one.
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Function name |
HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority);
|
hal_status_t HAL_InitTick(hal_tick_freq_t tick_freq,
uint32_t tick_priority);
|
|
Parameters |
HAL_InitTick:
uint32_t TickPriority
HAL_SetTickFreq:
HAL_TickFreqTypeDef Freq
|
hal_tick_freq_t tick_freq
uint32_t tick_priority
|
Msp initialization and de-initialization functions migration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Function names |
void HAL_MspInit(void);
void HAL_MspDeInit(void);
|
In HAL2, these functions have been removed. Users are required to implement their own sequences for initialization and deinitialization. |
Related concept : Remove MspInit and MspDeInit callbacks
HAL GENERIC control functions migration ¶
The following table lists the HAL peripheral control functions, indicating those that remain unchanged between HAL1 and HAL2
|
Function |
HAL1 / HAL2 |
|---|---|
|
Increment Tick |
void HAL_IncTick(void)
|
|
Delay |
void HAL_Delay(uint32_t delay_ms)
|
|
Get Tick |
uint32_t HAL_GetTick(void)
|
|
Get Tick priority |
uint32_t HAL_GetTickPrio(void)
|
|
Get Tick frequency |
HAL1: HAL_TickFreqTypeDef HAL_GetTickFreq(void)
HAL2: hal_tick_freq_t HAL_GetTickFreq(void) // Return type changed to follow new naming convention
|
|
Suspend Tick |
void HAL_SuspendTick(void)
|
|
Resume Tick |
void HAL_ResumeTick(void)
|
Related use cases: Use case: User application in most basic use case
Get HAL version ¶
Renamed from HAL_GetHalVersion in HAL1 to HAL_GetVersion in HAL2
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Function name |
uint32_t HAL_GetHalVersion(void)
|
uint32_t HAL_GetVersion(void)
|
Get Device ID ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, the function to get the device ID is named
|
In HAL2, it has been moved to the
DBGMCU
driver, renamed to
|
|
Function name |
uint32_t HAL_GetDEVID(void)
|
hal_dbgmcu_device_id_t HAL_DBGMCU_GetDeviceID(void)
|
Get revision ID ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, the function to get the revision ID is named
|
In HAL2, it has been moved to the
DBGMCU
driver, renamed to
|
|
Function name |
uint32_t HAL_GetREVID(void)
|
uint32_t HAL_DBGMCU_GetRevisionID(void)
|
Get unique device ID ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to get parts of the unique device ID. |
In HAL2, this functionality has been merged into a single function. |
|
Function name |
uint32_t HAL_GetUIDw0(void)
uint32_t HAL_GetUIDw1(void)
uint32_t HAL_GetUIDw2(void)
|
hal_status_t HAL_GetDeviceUniqueID(hal_device_uid_t *p_uid)
|
Related use cases: Use case: Retrieve device information
HAL DBGMCU control functions migration ¶
Enable DBG stop/sleep/standby mode ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to enable debug modes for Stop, Sleep, and Standby. |
In HAL2, these functionalities have been merged into a single function with a mode parameter. |
|
Function name |
void HAL_DBGMCU_EnableDBGStopMode(void);
void HAL_DBGMCU_EnableDBGSleepMode(void);
void HAL_DBGMCU_EnableDBGStandbyMode(void);
|
void HAL_DBGMCU_EnableDebugLowPowerMode(uint32_t mode)
|
Disable DBG stop/sleep/standby mode ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to disable debug modes for Stop, Sleep, and Standby. |
In HAL2, these functionalities have been merged into a single function with a mode parameter. |
|
Function name |
void HAL_DBGMCU_DisableDBGStopMode(void)
void HAL_DBGMCU_DisableDBGSleepMode(void)
void HAL_DBGMCU_DisableDBGStandbyMode(void)
|
void HAL_DBGMCU_DisableDebugLowPowerMode(uint32_t mode)
|
HAL SYSCFG/SBS control functions migration ¶
Select ethernet interface ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
SBS Function |
void HAL_SBS_ETHInterfaceSelect(uint32_t SBS_ETHInterface);
|
hal_status_t HAL_SBS_ETH_SetInterface(hal_sbs_eth_interface_t phy_int)
|
|
SYSCFG Function |
void HAL_SYSCFG_ETHInterfaceSelect(uint32_t SYSCFG_ETHInterface);
|
hal_status_t HAL_SYSCFG_ETH_SetInterface(hal_syscfg_eth_interface_t phy_int)
|
Enable/Disable compensation cell ¶
Enable compensation cell ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, enabling compensation cells was done using separate functions. |
In HAL2, the functions have been merged into a single function with a comp_cell parameter. |
|
Function name |
Example SYSCFG: void HAL_SYSCFG_EnableVddCompensationCell(void)
void HAL_SYSCFG_EnableVddIO2CompensationCell(void)
void HAL_SYSCFG_EnableVddHSPICompensationCell(void)
Example SBS: void HAL_SBS_EnableVddIO1CompensationCell(void)
void HAL_SBS_DisableVddIO1CompensationCell(void)
|
/* */
hal_status_t HAL_SYSCFG_EnableCompensationCell(uint32_t comp_cell)
hal_status_t HAL_SBS_EnableCompensationCell(uint32_t comp_cell)
|
Disable compensation cell ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, disabling compensation cells was done using separate functions. |
In HAL2, the functions have been merged into a single function with a comp_cell parameter. |
|
Function name |
Example SYSCFG: HAL_SYSCFG_DisableVddCompensationCell(void)
HAL_SYSCFG_DisableVddIO2CompensationCell(void)
HAL_SYSCFG_DisableVddHSPICompensationCell(void)
Example SBS: HAL_SBS_DisableVddIO1CompensationCell(void)
HAL_SBS_DisableVddIO2CompensationCell(void)
|
/* */
void HAL_SYSCFG_DisableCompensationCell(uint32_t comp_cell)
void HAL_SBS_DisableCompensationCell(uint32_t comp_cell)
|
Select compensation code ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_SBS_VDDCompensationCodeSelect(uint32_t SBS_CompCode)
HAL_SBS_VDDIOCompensationCodeSelect(uint32_t SBS_CompCode)
|
HAL_SBS_SetCompensationCellCodeSrc(uint32_t comp_cell, hal_sbs_ccell_code_src_t code_select)
|
Configure compensation code ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_SBS_VDDCompensationCodeConfig(uint32_t SBS_PMOSCode,
uint32_t SBS_NMOSCode)
HAL_SBS_VDDIOCompensationCodeConfig(uint32_t SBS_PMOSCode,
uint32_t SBS_NMOSCode)
|
HAL_SBS_SetConfigxMOSCompensationCellCode(uint32_t comp_cell,
uint32_t pmos_code, uint32_t nmos_code)
|
Get NMOS compensation value ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to get the NMOS compensation value for VDD and VDDIO2. |
In HAL2, these functionalities have been merged into a single function with a comp_cell parameter. |
|
Function name |
uint32_t HAL_SBS_GetNMOSVddCompensationValue(void)
uint32_t HAL_SBS_GetNMOSVddIO2CompensationValue(void)
|
uint32_t HAL_SBS_GetNMOSCompensationCellValue(uint32_t comp_cell)
|
Get PMOS compensation value ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to get the PMOS compensation value for VDD and VDDIO2. |
In HAL2, these functionalities have been merged into a single function with a comp_cell parameter. |
|
Function name |
uint32_t HAL_SBS_GetPMOSVddCompensationValue(void)
uint32_t HAL_SBS_GetPMOSVddIO2CompensationValue(void)
|
uint32_t HAL_SBS_GetPMOSCompensationCellValue(uint32_t comp_cell)
|
Get compensation cell ready flag ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to get the ready flag for VddIO1 and VddIO2 compensation cells. |
In HAL2, these functionalities have been merged into a single function, which will be declared as static inline in
|
|
Function name |
uint32_t HAL_SBS_GetVddIO1CompensationCellReadyFlag(void)
uint32_t HAL_SBS_GetVddIO2CompensationCellReadyFlag(void)
|
__STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_RDY1(void)
__STATIC_INLINE uint32_t LL_SBS_IsActiveFlag_RDY2(void)
|
Enable/Disable ECC NMI ¶
In both HAL1 and HAL2, the functions to enable/disable ECC NMI remain the same.
|
Function |
HAL1 / HAL2 |
|---|---|
|
Enable ECC NMI |
void HAL_SBS_FLASH_EnableECCNMI(void)
|
|
Disable ECC NMI |
void HAL_SBS_FLASH_DisableECCNMI(void)
|
Check state ECC NMI ¶
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_SBS_FLASH_ECCNMI_IsDisabled(void)
|
uint32_t HAL_SBS_FLASH_IsEnabledECCNMI(void)
|
Increment HDPL value ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_SBS_IncrementHDPLValue(void)
|
In HAL2, the increment is performed through the function :
HAL_SBS_SetHDPLevelValue(hal_sbs_hdp_level_value_t value);
or alternatively using the LL function:
void LL_SBS_IncrementHDPLevel(void);
|
Get HDPL value ¶
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_SBS_GetHDPLValue(void)
|
hal_sbs_hdp_level_value_t HAL_SBS_GetHDPLevelValue(void)
|
Set OBK HDPL ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SBS_SetOBKHDPL(uint32_t OBKHDPL_Value)
|
void HAL_SBS_SetHDPOBKLevelValue(hal_sbs_hdp_obk_level_value_t value)
|
Get OBK HDPL ¶
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_SBS_GetOBKHDPL(void)
|
hal_sbs_obk_hdpl_value_t HAL_SBS_GetHDPOBKLevelValue(void)
|
Set OTG PHY reference clock selection ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetOTGPHYReferenceClockSelection(uint32_t RefClockSelection)
|
void HAL_SYSCFG_SetUSBHSPHYReferenceClockFrequency(hal_syscfg_usbhsphy_frequency_t clk_frequency)
|
Set OTG PHY power down configuration ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetOTGPHYPowerDownConfig(uint32_t PowerDownConfig)
|
void HAL_SYSCFG_EnableUSBHSPHYPowerDown(void)
|
Enable OTG PHY ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_EnableOTGPHY(uint32_t OTGPHYConfig)
|
void HAL_SYSCFG_EnableUSBHSPHY(void)
|
Enable/Disable IO analog switch booster ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Description |
In HAL1, there are separate functions to enable and disable the IO analog switch booster. Additionally, in HAL1, there are separate functions to enable and disable the IO analog voltage selection. |
In HAL2, these functionalities have been merged into a single function with a parameter. To enable the booster, use HAL_SYSCFG_BOOSTER_SUPPLY as the parameter; to disable it, use HAL_SYSCFG_VDDA_SUPPLY . To enable the voltage selection, use HAL_SYSCFG_VDD_SUPPLY as the parameter. |
|
Function name |
void HAL_SYSCFG_EnableIOAnalogSwitchBooster(void);
void HAL_SYSCFG_DisableIOAnalogSwitchBooster(void);
void HAL_SYSCFG_EnableIOAnalogVoltageSelection(void);
void HAL_SYSCFG_DisableIOAnalogVoltageSelection(void);
|
void HAL_SYSCFG_SetAnalogIOSwitchSupply(hal_syscfg_analog_switch_t analog_switch);
|
Enable/Disable remap ¶
Enable remap ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_EnableRemap(uint32_t PinRemap)
|
void HAL_SYSCFG_EnablePinRemap(uint32_t pin_remap)
|
Disable remap ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_DisableRemap(uint32_t PinRemap)
|
void HAL_SYSCFG_DisablePinRemap(uint32_t pin_remap)
|
Set/Get pin binding ¶
Set Pin Binding
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetPinBinding(uint32_t pin_binding)
|
void HAL_SYSCFG_SetPinBinding(hal_syscfg_bind_package_pin_src_t pin_binding_source)
|
Get pin binding
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_SYSCFG_GetPinBinding(uint32_t pin_binding_source)
|
hal_syscfg_bind_package_pin_src_t HAL_SYSCFG_GetPinBinding(hal_syscfg_bind_package_pin_t pin_binding)
|
Set OTG PHY squelch threshold ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetOTGPHYSquelchThreshold(uint32_t SquelchThreshold);
|
void HAL_SYSCFG_SetUSBHSPHYSquelchThresholdAdjustment(hal_syscfg_squelch_adjust_t squelch_threshold);
|
Set OTG PHY disconnect threshold ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetOTGPHYDisconnectThreshold(uint32_t DisconnectThreshold);
|
void HAL_SYSCFG_SetUSBHSPHYDisconnectThresholdAdjustment(hal_syscfg_disconnect_adjustment_t disconnect_threshold);
|
Set OTG PHY pre-emphasis current ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetOTGPHYPreemphasisCurrent(uint32_t PreemphasisCurrent);
|
void HAL_SYSCFG_SetUSBHSPHYTransmitterPreemphasisCurrent(hal_syscfg_src_current_t src_current);
|
Set HSPI decoupling capacitance ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_SetHSPIDecouplingCapacitance(uint32_t Capacitance);
|
void HAL_SYSCFG_SetHSPISupplyDecouplingCapacitance(hal_syscfg_capacitance_t capacitance);
|
Get HSPI decoupling capacitance ¶
|
HAL1 |
HAL2 |
|---|---|
uint32_t HAL_SYSCFG_GetHSPIDecouplingCapacitance(void);
|
hal_syscfg_capacitance_t HAL_SYSCFG_GetHSPISupplyDecouplingCapacitance(void);
|
SRAM cacheability ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Enable function name |
void HAL_SYSCFG_EnableSRAMCached(void);
|
void HAL_SYSCFG_EnableDCACHE2SRAMCacheability(void);
|
|
Disable function name |
void HAL_SYSCFG_DisableSRAMCached(void);
|
void HAL_SYSCFG_DisableDCACHE2SRAMCacheability(void);
|
I/O speed optimization ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Enable function name |
void HAL_SYSCFG_EnableIOSpeedOptimize(void);
|
void HAL_SYSCFG_EnableIOSpeedOptimization(void);
|
|
Disable function name |
void HAL_SYSCFG_DisableIOSpeedOptimize(void);
|
void HAL_SBS_DisableIOSpeedOptimization(void);
|
HAL VREFBUF functions migration ¶
VREFBUF voltage scaling configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Function name |
void HAL_SYSCFG_VREFBUF_VoltageScalingConfig(uint32_t VoltageScaling)
/* or */
void HAL_VREFBUF_VoltageScalingConfig(uint32_t VoltageScaling)
|
hal_status_t HAL_VREFBUF_SetVoltageScale(hal_vrefbuf_t instance,
hal_vrefbuf_voltage_scale_t voltage_scale)
|
VREFBUF high impedance configuration ¶
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Function name |
void HAL_SYSCFG_VREFBUF_HighImpedanceConfig(uint32_t Mode)
/* or */
void HAL_VREFBUF_HighImpedanceConfig(uint32_t Mode)
|
hal_status_t HAL_VREFBUF_SetMode(hal_vrefbuf_t instance, hal_vrefbuf_mode_t mode)
|
VREFBUF trimming configuration ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_VREFBUF_TrimmingConfig(uint32_t TrimmingValue)
/* or */
void HAL_VREFBUF_TrimmingConfig(uint32_t TrimmingValue)
|
hal_status_t HAL_VREFBUF_SetTrimming(hal_vrefbuf_t instance, uint32_t trimming_value)
|
Enable VREFBUF configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SYSCFG_EnableVREFBUF(void)
/* or */
HAL_StatusTypeDef HAL_EnableVREFBUF(void)
|
Removed in HAL2, the user can enable the VREFBUF through
|
Disable VREFBUF configuration ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SYSCFG_DisableVREFBUF(void)
/* or */
void HAL_DisableVREFBUF(void)
|
In HAL2, this functionality has been removed and will be managed with a static inline function in LL.
|
Related use cases: Use case: VREFBUF configuration
HAL EXTI functions migration ¶
HAL EXTI generate SWI ¶
The Generate Software Interrupt function is removed from the HAL GENERIC driver and is now managed by a function in the HAL EXTI driver.
|
HAL1 |
HAL2 |
|---|---|
HAL_EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
|
HAL_EXTI_GenerateSWI(hal_exti_handle_t *hexti)
|
HAL EXTI edge configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_EXTI_EdgeConfig(uint32_t EXTI_Line , uint32_t EXTI_Edge )
|
Removed from HAL2 (EXTI edge is configure through the
|